package com.teach.servlet.admin;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.teach.entity.Lj;
import com.teach.service.LjService;
import com.teach.service.impl.LjServiceImpl;

//@WebServlet("/admin/lj-list-1.let")
public class LjList1Servlet extends HttpServlet{

	private LjService ljService = new LjServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//你应该设置默认值
		int current = 1;
		try {
			current = Integer.valueOf(request.getParameter("current"));
		}catch(Exception e) {
		}
		
		int rowMax = 5;
		try {
			rowMax = Integer.valueOf(request.getParameter("rowMax"));
		}catch(Exception e) {
		}
		
		List<Lj> list = ljService.list1(current, rowMax);
		Long total = ljService.count();
		request.setAttribute("list", list);
		request.setAttribute("total", total);
		request.getRequestDispatcher("/admin/lj-list1.jsp").forward(request, response);
	}
}
